<?php
 
// this file must be stored in:
// protected/components/WebUser.php
 
class WebMember extends CWebUser {
 
  // Store model to not repeat query.
  private $_model;
 
  // Return first name.
  // access it by Yii::app()->user->first_name
  function getUsername(){
    $user = $this->loadUser(Yii::app()->user->id);
    return $user->username;
  }
  function getAmount(){
  	$user = $this->loadUser(Yii::app()->user->id);
  	return $user->amount;
  }
//   function getEmail(){
//     $user = $this->loadUser(Yii::app()->user->id);
//     return $user->email;
//   }
  // Load user model.
  protected function loadUser($id=null)
    {
        if($this->_model===null)
        {
        	$this->_model=new Member;
            if($id!==null)
                $this->_model=Member::model()->findByPk($id);
        }
        return $this->_model;
    }
}
?>